package study

import (
	"errors"
)

func Divide(a, b int) (int, error) {
	if b == 0 {
		return 0, errors.New("division by zero")
	}
	return a / b, nil
}

func Filter(numbers []int, fn func(int) bool) []int {
	var res []int
	for _, n := range numbers {
		if fn(n) {
			res = append(res, n)
		}
	}
	return res
}
